/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.osdtsystem.utils;


import gnu.trove.TDoubleArrayList;
import java.util.AbstractList;

/**
 *
 * @author mwh
 */
public class TroveDoubleList extends AbstractList<Double> implements Trimmable{

    TDoubleArrayList list;

    public TroveDoubleList() {
        list = new TDoubleArrayList();
    }

    public TroveDoubleList(int capacity) {
        list = new TDoubleArrayList(capacity);
    }

    public TroveDoubleList(double[] array) {
        list = new TDoubleArrayList(array);
    }

    @Override
    public Double get(int index) {
        return list.get(index);
    }

    @Override
    public int size() {
        return list.size();
    }

    @Override
    public Double set(int index, Double element) {
        double oldvalue = list.get(index);
        list.set(index, element);
        return oldvalue;
    }

    @Override
    public boolean  add(Double element) {
      list.add(element);
      return true;
    }

    @Override
    public void add(int index, Double element) {
        throw new UnsupportedOperationException();
    }

    @Override
    public Double remove(int index) {
        return list.remove(index);
    }

    @Override
    public void trimToSize() {
        list.trimToSize();
    }
}
